#include<stdio.h>
#include<malloc.h>

typedef struct Stack{
int num;           
char source;       
char destination;   
char mid;          
struct Stack *down;
}stack;

stack *Push(int num,char source,char mid,char destination,stack *top);
stack *Pop(stack **top);

int main(void)
{
    int N,i;
    stack *top;
    stack *result;
    scanf("%d",&N);

    top=(stack *)malloc(sizeof(stack));
    top->down=NULL;
    top->source='a';
    top->mid='b';
    top->destination='c';
    top->num=N;               

    i=N-1;
    while(i){
      top=Push(i,top->source,top->destination,top->mid,top);
      i--;
    }

    while(top){
      result=Pop(&top);
      printf("%c -> %c\n",result->source,result->destination);
      i=result->num-1;
      if(!i)
        continue;
      stack *newOne;
      newOne=(stack *)malloc(sizeof(stack));
      newOne->num=i--;
      newOne->source=result->mid;
      newOne->mid=result->source;
      newOne->destination=result->destination;
      newOne->down=top;
      top=newOne;
      free(result);
      while(i){
        top=Push(i,top->source,top->destination,top->mid,top);
        i--;
      }
    }

    return 0;
}

stack *Push(int num,char source,char mid,char destination,stack *top)
{
    stack *newOne;
    newOne=(stack *)malloc(sizeof(stack));

    newOne->num=num;
    newOne->down=top;
    newOne->source=source;                    
    newOne->mid=mid;
    newOne->destination=destination;
    top=newOne;

    return top;
}

stack *Pop(stack **top)
{
    stack *mid;

    mid=*top;
    *top=(*top)->down;

    return mid;
}

